<%= form_for(@book) do |f| %>
<% if @book.errors.any? %>
<div id="error_explanation">
	<h2><%= pluralize(@book.errors.count, "error") %> prohibited this book from being saved:</h2>

	<ul>
		<% @book.errors.full_messages.each do |msg| %>
		<li>
			<%= msg %>
		</li>
		<% end %>
	</ul>
</div>
<% end %>
<table>
	<tr height="30" align="left">
		<td><b>Tên sách:</b></td>
		<td> <%= f.text_field :name %> </td>
	</tr>
	<tr height="30" align="left">
		<td><b>Danh mục:</b></td>
		<td> <%= f.select :category_id, @categories.map {|r| [r.name,r.id] } %> </td>
	</tr>
	<tr height="30" align="left">
		<td><b>Mô tả:</b></td>
		<td> <%= f.text_area :description %> </td>
	</tr>
	<tr height="30" align="left">
		<td><b>Số lượng:</b></td>
		<td> <%= f.number_field :numbers %> </td>
	</tr>	
	<tr height="30" align="left">
		<td><b>Số lượng đang mươn:</b></td>
		<td> <%= f.number_field :numbers_to_borrow %> </td>
	</tr>
	<tr height="30" align="left">
		<td><b>Tác giả:</b></td>
		<td> <%= f.text_field :author %> </td>
	</tr>	
	<tr height="30" align="left">
		<td><b>Hình ảnh:</b></td>
		<td> <%= f.text_field :link %> </td>
	</tr>
	<tr height="30" align="left">
		<td></td>
		<td><b><%= f.submit %></b></td>		
	</tr>
</table>

<% end %>
